-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build with boost ASIO 1.87. Support boost 1.66+ #9628
base: master
Are you sure you want to change the base?
Conversation
(This needs #9162 to pass depends CI. I will undraft that PR after the next round of merges.) |
8c98c45
to
e88e61d
Compare
The latest force push should work with Boost 1.66-1.87. Something funky happened with the tests, so I may push a dummy change later to see what happens. |
https://github.com/tobtoht/monero/actions/runs/12390979989/job/34587144842#step:5:1281 Looks like |
e88e61d
to
f185187
Compare
Fore pushed some changes:
|
1c62d08
to
da62d98
Compare
Force pushed twice with updates:
|
da62d98
to
a0ce1e9
Compare
Force pushed an include fix. |
This patch looks ready. The depends CI will all fail until #9162 gets merged. I will leave as draft for now for that reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README needs an update to indicate the new minimum version
Once this is ready for review, please remove Draft status. |
625f370
to
0452910
Compare
Force pushed:
Likely this will get removed as draft, assuming some of the tests cycle green. |
0452910
to
ad7eaaa
Compare
Forgot to update this in the last force push, so another quick push with this change. |
Now ready for review. |
Getting a ton of build errors across many platforms:
|
The dependencies system seems to still be pulling Boost 1.64 instead of 1.66 on these failed platforms |
@jeffro256 requires #9162 to be merged first |
Sorry, my bad. Should've read farther up in the comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From technical perspective, everything is great, and I don't see any specific issues.
The only remaining thing is I have to fetch #9162 and compile, and run all the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple actual comments, but mostly nitpicks
using io_context_t = boost::asio::io_service; | ||
using strand_t = boost::asio::io_service::strand; | ||
using io_context_t = boost::asio::io_context; | ||
using strand_t = boost::asio::io_context::strand; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using strand_t = boost::asio::io_context::strand; | |
using strand_t = io_context_t::strand; |
@@ -306,7 +308,7 @@ namespace net_utils | |||
virtual bool close(); | |||
virtual bool call_run_once_service_io(); | |||
virtual bool request_callback(); | |||
virtual boost::asio::io_service& get_io_service(); | |||
virtual boost::asio::io_context& get_io_context(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
virtual boost::asio::io_context& get_io_context(); | |
virtual io_context_t& get_io_context(); |
@@ -1767,7 +1776,7 @@ namespace net_utils | |||
if (r) | |||
{ | |||
new_connection_l->get_context(conn_context); | |||
//new_connection_l.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_pfilter)); | |||
//new_connection_l.reset(new connection<t_protocol_handler>(io_context_, m_config, m_sock_count, m_pfilter)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just remove this line?
try | ||
{ | ||
//resolving ipv4 address as ipv6 throws, catch here and move on | ||
iterator = resolver.resolve(query, resolve_error); | ||
results = resolver.resolve( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove DNS resolution from this function completely. This is supposed to be an async function, but this DNS call is not async, which I'm sure degrades the performance of the main I/O loop. Also, the one place in the codebase that calls connect_async()
(p2p) I think is calling it with raw IPv4 and IPv6 addresses, so it shouldn't even need DNS resolution.
try | ||
{ | ||
//resolving ipv4 address as ipv6 throws, catch here and move on | ||
iterator = resolver.resolve(query, resolve_error); | ||
results = resolver.resolve( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here as other comment: the one place this is called, we use raw IP addresses
@@ -32,7 +32,7 @@ | |||
|
|||
#include <atomic> | |||
|
|||
#include <boost/asio/io_service.hpp> | |||
#include <boost/asio/io_context.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this header include even be here in the first place?
m_want_close_connection(false), | ||
m_was_shutdown(false), | ||
m_is_multithreaded(false), | ||
m_ssl_support(ssl_support) | ||
{ | ||
// add nullptr checks if removed | ||
assert(m_state != nullptr); // release runtime check in get_context | ||
assert(m_state != nullptr); // release runtime check in get_contextp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?
|
||
socket_.next_layer() = std::move(sock); | ||
socket_.next_layer() = std::move(sock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's happening with the whitespace here?
results = resolver.resolve( | ||
boost::asio::ip::tcp::v6(), addr, port, boost::asio::ip::tcp::resolver::canonical_name | ||
); | ||
if (results.empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this overload of resolve()
shouldn't ever return an empty range because otherwise, it will throw a boost exception. That would make this if
branch unreachable.
throw boost::system::system_error{boost::asio::error::fault, "Failed to resolve " + addr}; | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
struct new_connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the move of this struct declaration purely for readability purposes?
This should compile with Boost 1.73-1.87. I have only tested on Boost 1.74 and Boost 1.87 (primarily unit tests). I will mark the places where I know changes need to be made for older boost versions. I will clear up all such errors by manually downloading Boost 1.66 and testing.
One problem I have with supporting Boost 1.66-1.69 is that most types require an io_context object, whereas Boost 1.70+ have relaxed this requirement to an executor object. I will show an example of where it matters; it will be easy to break older Boost versions unintentionally.
EDIT:
This is currently marked as a draft, because the depends build will fail until #9162 gets merged (which is also marked as draft).